//
//  YImageScanController.m
//  0717-上午
//
//  Created by 杨少伟 on 15/7/22.
//  Copyright (c) 2015年 YCompany. All rights reserved.
//

#import "YImageScanController.h"
#import "YImageScanView.h"
@interface YImageScanController ()<YImageScanViewDelegate>

@end

@implementation YImageScanController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    YImageScanView *imageScanView = [[YImageScanView alloc] initWithFrame:self.view.bounds style:YImageScanViewStyleDefault];
    [self.view addSubview:imageScanView];
    //设置数据
    imageScanView.imageList = self.imageList;
    imageScanView.currentPageIndex = self.index;
    imageScanView.delegate = self;
    imageScanView.label.hidden = YES;
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(backClick)];
    self.navigationItem.leftBarButtonItem  = item;
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.title = imageScanView.label.text;
    
}

- (void)backClick
{
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)imageScanView:(YImageScanView *)imageScanView currentIndex:(NSInteger)index
{
    self.title = [NSString stringWithFormat:@"%li/%li",index+1,self.imageList.count];
}



@end
